<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMerchantStatisticalsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('merchant_statisticals', function (Blueprint $table) {
            $table->unsignedBigInteger('id')->primary();
            $table->unsignedBigInteger('user_id')->default(0)->comment('用户ID!')->index('user');
            $table->integer('link_device_count')->default(0)->comment('设备总台数');
            $table->integer('link_group_count')->default(0)->comment('群组总数');
            $table->unsignedBigInteger('income')->default(0)->comment('总收益(分)');
            $table->unsignedBigInteger('today_turnover')->default(0)->comment('今日营业额(分)');
            $table->unsignedBigInteger('turnover')->default(0)->comment('总营业额(分)');
            $table->timestamps();
            $table->softDeletes();
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_unicode_ci';
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('merchant_statisticals');
    }
}
